/**
 * 退出登錄
 */
function logout(){
	//清除cookie
	clearCookie();
	//後台退出
	window.location.href = ctx + "logout";
}

/**
 * 修改密码弹窗
 * @returns
 */
function showchangepwdbox(){
	$('#resetpwd-box').show().window('open');	
}

/**
 * 提交修改密码
 * @returns
 */
function changepwd() {
	var pwd1 = $('#password1').textbox("getValue");
	var pwd2 = $('#password2').textbox("getValue");
	if (pwd1 != pwd2){
		$.messager.alert('提示',"兩次密码不一致，请重新輸入",'info');
		return;
	}	
	$('#resetpwd-form').form('submit', {
		url:$("#resetpwd-form").attr('action'),
		onSubmit : function(param) {							
			return $(this).form('validate');
		},
		success : function(data) {
			var curdata = data;
			try {
				var data = eval('(' + data + ')');
				curdata = data.message;
			} catch (err) {
				//在这里处理错误
			}
			$.messager.alert('Info', curdata, 'info');
			$('#resetpwd-box').dialog('close');
		},
		onLoadError : function(XMLHttpRequest, textStatus, errorThrown) {
			$.messager.alert('Info', XMLHttpRequest.responseText, 'info');
		}
	});			
}


$(function(){
 	//获取当前时
   	var date=new Date();
   	var Y=date.getFullYear();
   	var M=date.getMonth()+1;
   	if(M<10) M="0"+M;
   	var D=date.getDate();
   	if(D<10) D="0"+D;

   	var weekday=new Array(7);
   	weekday[0]="星期日";
   	weekday[1]="星期一";
   	weekday[2]="星期二";
   	weekday[3]="星期三";
   	weekday[4]="星期四";
   	weekday[5]="星期五";
   	weekday[6]="星期六";
   	$("#date").text(Y+"年"+M+"月"+D+"日 "+weekday[date.getDay()]);
})